﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Ventas.Master" AutoEventWireup="true" CodeBehind="PurchaseOrder.aspx.cs" Inherits="Trade.WebForm1" %>

<%@ Register Assembly="DevExpress.XtraReports.v13.1.Web, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.XtraReports.Web" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxNavBar" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>


<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Data.Linq" tagprefix="dx" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Estilos del menu Bar -->
<style type="text/css">
/* -- ASPxNavBar Lite -- */
.dxnbLite_SoftOrange1 
{
	color: white;
	background-color: transparent;
	border: 4px Solid #D3D3D3;
	font: 12px Tahoma, Geneva, sans-serif;
    font-weight:bold;
	list-style: none none outside;
	margin: 0;
	padding: 1px;
	float: left;
	width: 99%;
}
.dxnbLite_SoftOrange1 .dxnb-content 
{
	color: #FFF;
	border-bottom: 1px Dotted #5C5C5C;
	list-style: none none outside;
	margin: 0;
	padding: 2px 1px;
	overflow: hidden;
}
.dxgvControl_Metropolis1,
.dxgvDisabled_Metropolis1
{
	border: 1px Solid #c0c0c0;
	font: 12px 'Segoe UI', Helvetica, 'Droid Sans', Tahoma, Geneva, sans-serif;
	background-color: #0e1452;
	color: #FFF;
	cursor: default;
}
.dxgvHeader_Metropolis1
{
	cursor: pointer;
	white-space: nowrap;
	padding: 4px 6px 5px;
	border: 1px Solid #FFF;
	overflow: hidden;
	font-weight: normal;
	text-align: left;
	background-color: #0e1452;
}
.dxgvTable_Metropolis1
{
	background-color: transparent;
	border-width: 0;
	border-collapse: separate!important;
	overflow: hidden;
}
</style>
<script type="text/javascript">
    var precio = 0;
    var numero_cajas = 0;
    var peso = 0;
    var porcentaje = 1;
    var peso_neto = 0;
    var tipo = 0;
    var avance = 0;
</script>

<!-- Inicio del cuerpo Medio -->
    <div id="cuerpo_medio"  style="position:absolute; height:490px;width:1000px;margin-top:6px;display:inline-table;border:1px solid #EF7F01;vertical-align:middle;left:50%;margin-left:-500px;">
        <div>
            <table style="width:100%;">
                <tr>
                    <td>
                        <dx:ASPxLabel ID="ASPxLabel1" runat="server" Font-Bold="true" ForeColor="White" Text="PURCHASE ORDER"></dx:ASPxLabel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table style="width:20%">
                            <tr>
                                <td style="width:67px">
                                    <dx:ASPxButton ID="btnNuevo" runat="server" Text="NEW" Theme="SoftOrange1" 
                                        UseSubmitBehavior="false" onclick="btnNuevo_Click"></dx:ASPxButton>
                                </td>
                                <td style="width:67px">
                                    <dx:ASPxButton ID="btnGrabar" runat="server" Text="SAVE" Theme="SoftOrange1" 
                                        OnClick="btn_Grabar_Click">
                                        <ClientSideEvents Click="function(s, e) {
	                                                                                e.processOnServer = true;
                                                                                }" />
                                    </dx:ASPxButton>
                                </td>
                                <td style="width:67px">
                                    <dx:ASPxButton ID="btnImprimir" runat="server" Text="PRINT" Theme="SoftOrange1" UseSubmitBehavior="false"
                                       Enabled="true" onclick="btnImprimir_Click"></dx:ASPxButton>
                                </td>
                                <td style="width:67px">
                                    <dx:ASPxButton ID="btnEliminar" runat="server" Text="END" Theme="SoftOrange1" 
                                        UseSubmitBehavior="false" onclick="btnEliminar_Click"></dx:ASPxButton>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr style="margin-top:10px;">
                    <td>
                        <dx:ASPxNavBar ID="NavBar_Cliente" runat="server" RenderMode="Lightweight" 
                            Theme="SoftOrange1" ShowLoadingPanelImage="False" Width="99.5%" 
                            onitemclick="NavBar_Cliente_ItemClick" >
                            <Groups>
                                <dx:NavBarGroup>
                                    <HeaderTemplate> VENDOR </HeaderTemplate>
                                    <ContentTemplate>
                                        <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                            <tr style="font-size:12px;">
                                                <td style="width:177px;">
                                                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Vendor Name:"></dx:ASPxLabel>
                                                </td>
                                                <td style="width:303px;">
                                                    <dx:ASPxButtonEdit ID="btnBuscarCliente" runat="server" 
                                                        OnButtonClick="btnBuscarCliente_ButtonClick" Theme="Metropolis1" >
                                                        <Buttons>
                                                            <dx:EditButton>
                                                            </dx:EditButton>
                                                        </Buttons>
                                                    </dx:ASPxButtonEdit>
                                                </td>
                                                <td style="width:170px;">
                                                    <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Purchase Date:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxDateEdit ID="purchase_date" runat="server"></dx:ASPxDateEdit>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel4" runat="server" Text="Contact Name:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtContactName" runat="server" Width="170px" 
                                                        Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel5" runat="server" Text="Purchase Order #:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtNumberOrder" runat="server" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                             <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel6" runat="server" Text="Phone #:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPhone" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel7" runat="server" Text="Purchased by:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPurchased" runat="server" Width="170px" ></dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel8" runat="server" Text="Fax #:"></dx:ASPxLabel>
                                                </td>
                                                <td >
                                                    <dx:ASPxTextBox ID="txtFax" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel9" runat="server" Text="Payment Terms:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <dx:ASPxSpinEdit ID="spePaymentTerms" runat="server" Height="21px" 
                                                                MaxLength="30" MaxValue="30" MinValue="1" Number="0" NumberType="Integer" 
                                                                Theme="Metropolis1" Width="50px" />
                                                            </td>
                                                            <td>
                                                                <dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="Days after ETD" Width="150">
                                                                </dx:ASPxLabel>
                                                            </td>
                                                        </tr>
                                                     </table>
                                                    
                                                    
                                                </td>
                                           </tr>
                                            <tr>
                                            
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel10" runat="server" Text="Email Address:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtEmail" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                   <dx:ASPxCheckBox ID="ckbAdvance" runat="server"  Width="170px" Text="Advance:"  
                                                        ForeColor="White"   Theme="Metropolis1" CheckState="Unchecked" 
                                                        oncheckedchanged="ckbAdvance_CheckedChanged">
                                                       <ClientSideEvents CheckedChanged="function(s, e) {
	                                                                                                         e.processOnServer = true;
                                                                                                        }" />
                                                    </dx:ASPxCheckBox>
                                                </td>
                                                <td>
                                                     <table>
                                                        <tr>
                                                               <td>
                                                                <dx:ASPxSpinEdit ID="speAdvance" runat="server" Height="21px" 
                                                                MaxLength="100" MaxValue="100" MinValue="1" Number="0" 
                                                                Theme="Metropolis1" Width="50px" Enabled="false">
                                                                   </dx:ASPxSpinEdit>
                                                                </td>
                                                                <td>
                                                                <dx:ASPxLabel ID="lbladvance" runat="server" Width="50px" Text="%" ForeColor="White" Theme="Metropolis1"></dx:ASPxLabel>
                                                                </td>
                                                        </tr>

                                                    </table>
                                                    
                                                </td>
                                            </tr> 
                                        </table>
                                    </ContentTemplate>
                                </dx:NavBarGroup>
                                <dx:NavBarGroup>
                                    <HeaderTemplate> MORE DATA </HeaderTemplate>
                                    <ContentTemplate>
                                        <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                            <tr style="font-size:12px;">
                                                <td class="style5">
                                                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Term of Delivery:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxComboBox ID="cbxTermDelivery" runat="server" Theme="Metropolis1" 
                                                        ValueType="System.String" DataSourceID="PartialShipment" ValueField="codigo" TextField="descripcion">
                                                    </dx:ASPxComboBox>
                                                </td>
                                                <td class="style6">
                                                    <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Shimpment ETD:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxDateEdit ID="date_ETD" runat="server"></dx:ASPxDateEdit>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td class="style5">
                                                    <dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="Transshipment:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxComboBox ID="cbxTransshipment" runat="server" Theme="Metropolis1" 
                                                        ValueType="System.String" DataSourceID="Permitir" ValueField="codigo" TextField="descripcion">
                                                    </dx:ASPxComboBox>
                                                </td>
                                                <td class="style6">
                                                    <dx:ASPxLabel ID="ASPxLabel12" runat="server" Text="Shimpment ETA:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxDateEdit ID="date_ETA" runat="server"></dx:ASPxDateEdit>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td class="style5">
                                                    <dx:ASPxLabel ID="ASPxLabel13" runat="server" Text="Port of Discharge:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPortDischarge" runat="server" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                                <td class="style6">
                                                    <dx:ASPxLabel ID="ASPxLabel14" runat="server" Text="Partial Shipment:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxComboBox ID="cbxPartialShipmnt" runat="server" Theme="Metropolis1" 
                                                        ValueType="System.String" DataSourceID="Permitir" ValueField="codigo" TextField="descripcion">
                                                    </dx:ASPxComboBox>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td class="style5">
                                                    <dx:ASPxLabel ID="ASPxLabel15" runat="server" Text="Final destination:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtfinaldestination" runat="server" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                                <td class="style6">
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            </table>
                                    </ContentTemplate>
                                </dx:NavBarGroup>
                                <dx:NavBarGroup Expanded = "false">
                                    <HeaderTemplate> PROCESSING FACILITY INFORMATION </HeaderTemplate>
                                    <ContentTemplate>
                                        <table style="border-right:2px white solid;border-left:2px white solid;border-top:2px white solid;border-bottom:2px white solid;width:100%;">
                                            <tr style="font-size:12px;">
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Packer's Name:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtPacker" runat="server" Width="170px" Theme="Metropolis1"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Importer Name:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxComboBox ID="cbxImporterName" runat="server" Theme="Metropolis1" DataSourceID="Importer" 
                                                        ValueType="System.String" TextField="nombre" ValueField="codigo">
                                                    </dx:ASPxComboBox>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="Address:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxMemo ID="txtAdrdress" runat="server" Height="35px" Width="170px"></dx:ASPxMemo>
                                                </td>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel12" runat="server" Text="Brocker Name:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtBrokerName" runat="server" Theme="Metropolis1" 
                                                        Width="170px">
                                                    </dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                            <tr style="font-size:12px;">
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel13" runat="server" Text="FDA Registration:"></dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtFDA" runat="server" Width="170px"></dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                            </table>
                                    </ContentTemplate>
                                </dx:NavBarGroup>
                            </Groups>
                        </dx:ASPxNavBar>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div id="Order_Detail">
                            <dx:ASPxGridView ID="dtgDetalleOrden" runat="server" 
                                AutoGenerateColumns="False" EnableTheming="True" Theme="Metropolis1" 
                                KeyFieldName="numero" Width="101%" DataSourceID="Grid_Source">
                                <Columns>
                                    <dx:GridViewCommandColumn VisibleIndex="0">
                                        <NewButton Visible="True" text="New">
                                        </NewButton>
                                        <DeleteButton Visible="True" Text="Delete">
                                        </DeleteButton>
                                        <CancelButton Text="Cancel">
                                        </CancelButton>
                                        <UpdateButton Text="Insert">
                                        </UpdateButton>
                                    </dx:GridViewCommandColumn>
                                    <dx:GridViewDataTextColumn FieldName="idEmpresa" VisibleIndex="1" ReadOnly="True" Visible="False">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="numero" VisibleIndex="2" ReadOnly="True" Visible="False">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="linea" VisibleIndex="3" ReadOnly="True" Visible="False">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataComboBoxColumn FieldName="tipo" VisibleIndex="4" Caption="Type" Width="50px" >
                                        <propertiescombobox valuetype="System.String" DataSourceID="EDSType" TextField="descripcion" ValueField="codigo">                               
                                            <ClientSideEvents SelectedIndexChanged="function(s, e) {
                                                                                                        tipo = s.GetValue();
                                                                                                    }" />
                                        </propertiescombobox>
                                    </dx:GridViewDataComboBoxColumn>
                                    <dx:GridViewDataComboBoxColumn FieldName="talla"  VisibleIndex="5" Caption="Size" Width="70px">
                                        <propertiescombobox valuetype="System.String" DataSourceID="EDSSize" TextField="descripcion" ValueField="codigo"/>
                                    </dx:GridViewDataComboBoxColumn>
                                    <dx:GridViewDataComboBoxColumn FieldName="marca" VisibleIndex="6" Caption="Brand" Width="80px">
                                        <propertiescombobox valuetype="System.String" DataSourceID="EDSBrand" TextField="descripcion" ValueField="codigo"/>
                                    </dx:GridViewDataComboBoxColumn>
                                    <dx:GridViewDataMemoColumn FieldName="cajas" VisibleIndex="7" Caption="Cases" Width="40px">
                                        <PropertiesMemoEdit Width="50px" Height="15px">
                                            <ClientSideEvents TextChanged="function(s, e) {
                                                                                                numero_cajas = s.GetText();
                                                                                            }" />
                                        </PropertiesMemoEdit>
                                    </dx:GridViewDataMemoColumn>
                                    <dx:GridViewDataComboBoxColumn FieldName="packing" VisibleIndex="8" Width="50px">
                                        <propertiescombobox valuetype="System.String" DataSourceID="EDSPacking" 
                                            TextField="descripcion" ValueField="codigo">
                                            <ClientSideEvents SelectedIndexChanged="function(s, e) {
                                                                                                        var value = s.GetValue();
                                                                                                        switch(value) {
                                                                                                                         case 1: 
                                                                                                                             peso = 10;
                                                                                                                             break;
                                                                                                                         case 2: 
                                                                                                                             peso = 20;
                                                                                                                             break;
                                                                                                                         case 3: 
                                                                                                                             peso = 40;
                                                                                                                             break;
                                                                                                                         case 4: 
                                                                                                                             peso = 50;
                                                                                                                             break;
                                                                                                                         case 5: 
                                                                                                                             peso = 24;
                                                                                                                             break;
                                                                                                                         case 6: 
                                                                                                                             peso = 10;
                                                                                                                             break;
                                                                                                                         case 7: 
                                                                                                                             peso = 20;
                                                                                                                             break;
                                                                                                                         default: 
                                                                                                                             break;
                                                                                                                         }
                                                                                                    }" />
                                        </propertiescombobox>
                                    </dx:GridViewDataComboBoxColumn>
                                    <dx:GridViewDataSpinEditColumn FieldName="porcentaje" VisibleIndex="9" Caption="Block %" Width="50px">
                                        <PropertiesSpinEdit MaxValue="100" MinValue="75" NumberFormat="Number">
                                            <ClientSideEvents NumberChanged="function(s, e) {
                                                                                                var por = s.GetText()
                                                                                                porcentaje = por / 100;
                                                                                            }" />
                                        </PropertiesSpinEdit>
                                    </dx:GridViewDataSpinEditColumn>
                                    <dx:GridViewDataCheckColumn FieldName="tail"  VisibleIndex="10" Caption="Tail On" Width="50px">
                                        <PropertiesCheckEdit>
                                            <ClientSideEvents GotFocus="function(s, e) {
                                                                                             if(tipo==1 || tipo ==2)
                                                                                                {
	                                                                                                s.enabled = false;
                                                                                                    s.SetVisible(false);
                                                                                                }
                                                                                                else
                                                                                                {   
                                                                                                    s.enabled = true;
                                                                                                    s.SetVisible(true);
                                                                                                }
                                                                                        }" />
                                        </PropertiesCheckEdit>
                                    </dx:GridViewDataCheckColumn>
                                    <dx:GridViewDataComboBoxColumn FieldName="glaseado" VisibleIndex="11" Width="40px" Caption="Glaze">
                                        <propertiescombobox valuetype="System.String" DataSourceID="EDSGaseado" 
                                            TextField="descripcion" ValueField="codigo">
                                            <ClientSideEvents GotFocus="function(s, e) {
	                                                                                         if(tipo==1 || tipo ==2)
                                                                                                {
	                                                                                                s.enabled = false;
                                                                                                    s.SetVisible(false);
                                                                                                }
                                                                                                else
                                                                                                {   
                                                                                                    s.enabled = true;
                                                                                                    s.SetVisible(true);
                                                                                                }
                                                                                            }" />
                                        </propertiescombobox>
                                    </dx:GridViewDataComboBoxColumn>
                                    <dx:GridViewDataMemoColumn FieldName="quimico" VisibleIndex="12" Caption="Treatment" Width="70px">
                                        <PropertiesMemoEdit Width="100px" Height="15px">
                                            <ClientSideEvents GotFocus="function(s, e) {
                                                                                                if(tipo==1 || tipo ==2)
                                                                                                {
	                                                                                                s.enabled = false;
                                                                                                    s.SetVisible(false);
                                                                                                }
                                                                                                else
                                                                                                {   
                                                                                                    s.enabled = true;
                                                                                                    s.SetVisible(true);
                                                                                                }
                                                                                        }" />
                                        </PropertiesMemoEdit>
                                    </dx:GridViewDataMemoColumn>
                                    <dx:GridViewDataTextColumn FieldName="pesoNeto" VisibleIndex="13" Caption="NW" Width="30px">
                                        <PropertiesTextEdit Width="40px" >
                                            <ClientSideEvents Init="function(s, e) {
                                                                                        s.SetText(peso_neto);
                                                                                    }" 
                                                            GotFocus="function(s, e) {
                                                                                         peso_neto = peso_neto = numero_cajas * peso * porcentaje;
	                                                                                     s.SetText(peso_neto);
                                                                                     }" />
                                        </PropertiesTextEdit>
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="pesoBruto" VisibleIndex="14" Caption="GW" Width="30px">
                                        <PropertiesTextEdit Width="40px" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataMemoColumn FieldName="precio" VisibleIndex="15" Caption="Price" Width="40px">
                                        <PropertiesMemoEdit Width="50px" Height="15px"/>
                                    </dx:GridViewDataMemoColumn>
                                    <dx:GridViewDataMemoColumn FieldName="observacion" VisibleIndex="16" Caption="Comments">
                                        <PropertiesMemoEdit Width="100px" Height="15px"/>
                                    </dx:GridViewDataMemoColumn>
                                </Columns>
                                <SettingsPager Visible="False">
                                </SettingsPager>
                                <SettingsEditing Mode="Inline" />
                            </dx:ASPxGridView>
                                    <asp:EntityDataSource ID="EDSType" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Tipo" EntityTypeFilter="Tipo" 
                                                Select="it.[descripcion], it.[codigo]" 
                                onselecting="EDSType_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="EDSSize" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Talla" EntityTypeFilter="Talla" 
                                onselecting="EDSSize_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="EDSBrand" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Marca" EntityTypeFilter="Marca" 
                                onselecting="EDSBrand_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="EDSPacking" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Packing" EntityTypeFilter="Packing" 
                                onselecting="EDSPacking_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="EDSGaseado" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Glaseado" EntityTypeFilter="Glaseado" 
                                                Select="it.[codigo], it.[descripcion]" 
                                onselecting="EDSGaseado_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="PartialShipment" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="TerminosEnvio" 
                                    EntityTypeFilter="TerminosEnvio" 
                                onselecting="PartialShipment_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="Permitir" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="Permitir" 
                                    EntityTypeFilter="Permitir" onselecting="Permitir_Selecting">
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="Grid_Source" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="DetalleFacturaCamaron" 
                                                EntityTypeFilter="DetalleFacturaCamaron" 
                                                EnableDelete="True" EnableInsert="True"
                                                onselecting="Grid_Source_Selecting">
                                                <InsertParameters>
                                                    <asp:SessionParameter Name="empresa" SessionField="Id_Empresa" Type="Decimal"/>
                                                    <asp:SessionParameter Name="numero" SessionField="Id_Order" Type="Decimal"/>
                                                    <asp:SessionParameter Name="linea" SessionField="Id_Linea" Type="Decimal"/>
                                                    <asp:Parameter Name="tipo" Type="Decimal" />
                                                    <asp:Parameter Name="talla" Type="Decimal"/>
                                                    <asp:Parameter Name="marca" Type="Decimal"/>
                                                    <asp:Parameter Name="cajas" Type="Decimal"/>
                                                    <asp:Parameter Name="packing" Type="Decimal"/>
                                                    <asp:Parameter Name="porcentaje" Type="Decimal"/>
                                                    <asp:Parameter Name="tail" Type="Boolean"/>
                                                    <asp:Parameter Name="glaseado" Type="Decimal"/>
                                                    <asp:Parameter Name="quimico" Type="String"/>
                                                    <asp:Parameter Name="pesoNeto" Type="Decimal"/>
                                                    <asp:Parameter Name="pesoBruto" Type="Decimal"/>
                                                    <asp:Parameter Name="precio" Type="Decimal"/>
                                                    <asp:Parameter Name="observacion" Type="String"/>
                                                </InsertParameters>
                                                <DeleteParameters>
                                                    <asp:SessionParameter Name="numero" Type="Decimal"/>
                                                </DeleteParameters>
                                    </asp:EntityDataSource>
                                    <asp:EntityDataSource ID="Importer" runat="server" 
                                                ConnectionString="name=General_Entities" 
                                                DefaultContainerName="General_Entities" EnableFlattening="False" 
                                                EntitySetName="NombreImportadora" 
                                EntityTypeFilter="NombreImportadora" onselecting="Importer_Selecting">
                                </asp:EntityDataSource>
                        </div><!-- fin order detail-->
                        

                    </td>
                    <td>
                        <dx:ASPxPopupControl ID="Popup_Buscar_Cliente" runat="server" RenderMode="Lightweight"
                        HeaderText="Provider's List" Modal="true" PopupHorizontalAlign="WindowCenter"
                        PopupVerticalAlign="WindowCenter" Theme="SoftOrange1" EnableTheming="true">
                            <ContentCollection>
                                <dx:PopupControlContentControl>
                                     <div id="recuadro_inicio" style="width:450px;margin-left:auto;margin-right:auto;margin-top:10px;overflow:hidden;height:auto;background-color:#FFF;border:2px solid #B74900;">
                                         <dx:ASPxGridView ID="grid_Proveedores" runat="server" Theme="SoftOrange1"
                                             AutoGenerateColumns="false" DataSourceID="SourceProveedores" KeyFieldName="Codigo">
                                             <ClientSideEvents RowDblClick="function(s, e) {
                                                                                              var key = s.GetRowKey(e.visibleIndex);
                                                                                              window.location.href='PurchaseOrder.aspx?prov='+key;
                                                                                            }" />
                                             <Columns>
                                                 <dx:GridViewDataTextColumn FieldName="Codigo" VisibleIndex="0" ></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn FieldName="Nombre" VisibleIndex="1"></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn FieldName="Telefono" VisibleIndex="2"></dx:GridViewDataTextColumn>
                                                 <dx:GridViewDataTextColumn FieldName="Correo" VisibleIndex="3"></dx:GridViewDataTextColumn>
                                             </Columns>
                                             <SettingsBehavior AllowFocusedRow="true"/>
                                             <Settings ShowFilterRow="True" ShowGroupPanel="True" />
                                         </dx:ASPxGridView>
                                         <asp:ObjectDataSource ID="SourceProveedores" runat="server" 
                                             SelectMethod="ConsultarProveedor" TypeName="Datos.datOrdenCompra">
                                             <SelectParameters>
                                                 <asp:SessionParameter DefaultValue="" Name="id_Empresa" SessionField="Id_Empresa" Type="Decimal" />
                                             </SelectParameters>
                                         </asp:ObjectDataSource>
                                    </div>
                                </dx:PopupControlContentControl>
                            </ContentCollection>
                        </dx:ASPxPopupControl>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                     <dx:ASPxPopupControl ID="PopupError" runat="server" RenderMode="Lightweight"
                        HeaderText="Error" Modal="true" PopupHorizontalAlign="WindowCenter"
                        PopupVerticalAlign="WindowCenter" Theme="SoftOrange1" EnableTheming="true">
                            <ContentCollection>
                                <dx:PopupControlContentControl>
                                <div id="Div1" style="width:450px;margin-left:auto;margin-right:auto;margin-top:10px;overflow:hidden;height:293px;background-color:#FFF;border:2px solid #B74900;">
                                    <div id="recuadro_inicio_logo" style="width:430px;margin-bottom:0px;margin-left:10px;margin-right:10px;margin-top:10px;height:100px;">
                                        <img src="Images/LogoTTB-blanco.jpg"  width="420" alt=""/>
                                    </div>
                                    <div id="recuadro_inicio_campos" style="width:428px;margin-bottom:10px;margin-left:10px;margin-right:10px;margin-top:0px;background-color:#EEE;border:2px solid #B74900;height:170px;">
                                        <table border="0" style="width:100%;margin-top:35px;margin-left:70px;">
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="lblClaveIncorrecta" runat="server" Text="Not select a company" Visible="false" ForeColor="Red" Font-Size="20px" Font-Bold="true"></dx:ASPxLabel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <div style="margin-left:110px;">
                                                        <dx:ASPxButton ID="btnAceptarError" runat="server" Text="Accept" 
                                                            VerticalAlign="Middle" HorizontalAlign="Center" Theme="SoftOrange1" 
                                                            OnClick="btnError_Click"></dx:ASPxButton>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                                </dx:PopupControlContentControl>
                            </ContentCollection>
                        </dx:ASPxPopupControl>
                    </td>
                </tr>
            </table>
        </div>
    </div> 
</asp:Content>
